<p id="notice"><%= notice %></p>

<h1 class="text-center">全部帖子</h1>

<table class="table table-striped">
  <thead>
    <tr>
      <th>帖子名称</th>
      <th>帖子内容</th>
      <th>帖子创建人</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @posts.each do |post| %>
      <tr>
        <td><%= post.title %></td>
        <td><%= post.content %></td>
        <td><%= User.find(post.user_id).name %></td>
        <td><%= link_to '查看帖子', post %></td>
        <td><%= link_to '修改帖子', edit_post_path(post) %></td>
        <td><%= link_to '删除帖子', post, method: :delete, data: { confirm: '您确定吗?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Post', new_post_path %>
